<script type="text/javascript" charset="utf-8" src="/public/static/plugin/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/public/static/plugin/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
	
        //上传独立使用		
        var _editor = UE.getEditor('upload_ue', {'serverUrl':"/platform/?r=finance/upload"});
        _editor.ready(function () {
            _editor.setDisabled();
            _editor.hide();			
            _editor.addListener('afterUpfile', function (t, arg) {				
				if(!arg) {
					alert("<{'您未选择任何文件！' t}>");
					return false;
				}
				var html = "<ul style='list-style-type:decimal'>", vStr = "";
				$(arg).each(function(key, val){
					html += "<li> <code>"+ val.title +"</code><span class='close1'></span><input name=fileList[] value='"+ val.title +"||"+ val.url +"' type=hidden  /></li>";										
				});
				html += "</ul>";
				$("#attachment").prepend(html);				
            })
        });

		$(".close1").live('click', function(){		
			$(this).parent().remove();
		});

        function upFiles() {
			$(".editor").show();
            var myFiles = _editor.getDialog("attachment");
			myFiles.open();
			
			myFiles.onclose = function(t, ok){				
				if (typeof window.top.$.LayoutPreview !== 'undefined'){			
					window.top.$.LayoutPreview.setKeepShow(false);
				}
				return ok ? myFiles.onok() : myFiles.oncancel();
			};
						
			if (typeof window.top.$.LayoutPreview !== 'undefined'){			
				window.top.$.LayoutPreview.setKeepShow(true);
			}
        }

</script>
<style type="text/css">
	.close1{
		display: inline-block;
		width: 18px;
		height: 18px;
		margin-left: -8px;
		background: url(/public/static/images/close1.png) no-repeat;
	}
	
</style>